<?php

class Admin_Model_NodeConfig {
	public $Id;
	public $Module;
	public $Controller;
	public $Name;
	
	public function __construct($options = null)
    {
        if (is_array($options)) {
            $this->setOptions($options);
        }
    }
	public function __set($name, $value)
    {
        $method = 'set' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid property');
        }
        $this->$method($value);
    }

    public function __get($name)
    {
        $method = 'get' . $name;
        if (('mapper' == $name) || !method_exists($this, $method)) {
            throw new Exception('Invalid property');
        }
        return $this->$method();
    }
    
	public function setOptions(array $options)
    {
        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }
    
	public function setId($id) {
		$this->Id = $id;
		return $this;
	}
	
	public function setModule($module){
		$this->Module = $module;
		return $this;
	}
	
	public function setName($name) {
		$this->Name = $name;
		return $this;
	}
	
	public function setController($controller)
	{
		$this->Controller = $controller;
		return $this;
	}
	public function getId() {
		return $this->Id;
	}
	
	public function getModule() {
		return $this->Module;
	}

	public function getName() {
		return $this->Name;
	}
	
	public function getController() {
		return $this->Controller;
	}
	
}

?>